
<%@ page import="io.github.luyanfei.Question"%>
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main">
<g:set var="entityName"
	value="${message(code: "question.${params.qtype}.label", default: 'Question')}" />
<g:set var="questiontype" value="${params['qtype']}" />
<title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
	<div class="row">
		<g:set var="vhref" value="${createLink(action: 'create', params: [qtype: questiontype]) }"/>
		<g:set var="vtitle" value="${message(code: 'default.new.label', args: [entityName]) }"/>
		<g:render template="/shared/navbar" model="[links: [[href: vhref, title: vtitle]]]"></g:render>
	</div>
	<div id="list-question" class="content scaffold-list" role="main">
		<h1>
			<g:message code="default.list.label" args="[entityName]" />
		</h1>
		<g:if test="${flash.message}">
			<div class="message" role="status">
				${flash.message}
			</div>
		</g:if>
		<table>
			<thead>
				<tr>

					<g:sortableColumn property="title"
						title="${message(code: 'question.title.label', default: 'Title')}" />

					<g:sortableColumn property="content"
						title="${message(code: 'question.content.label', default: 'Content')}" />

					<th><g:message code="question.createdBy.label"
							default="Created By" /></th>

					<g:sortableColumn property="dateCreated"
						title="${message(code: 'question.dateCreated.label', default: 'Date Created')}" />

					<g:sortableColumn property="defaultMark"
						title="${message(code: 'question.defaultMark.label', default: 'Default Mark')}" />

					<g:sortableColumn property="feedback"
						title="${message(code: 'question.feedback.label', default: 'Feedback')}" />

				</tr>
			</thead>
			<tbody>
				<g:each in="${questionInstanceList}" status="i"
					var="questionInstance">
					<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">

						<td><g:link action="show" id="${questionInstance.id}">
								${fieldValue(bean: questionInstance, field: "title")}
							</g:link></td>

						<td>
							${fieldValue(bean: questionInstance, field: "content")}
						</td>

						<td>
							${fieldValue(bean: questionInstance, field: "createdBy")}
						</td>

						<td><g:formatDate date="${questionInstance.dateCreated}" /></td>

						<td>
							${fieldValue(bean: questionInstance, field: "defaultMark")}
						</td>

						<td>
							${fieldValue(bean: questionInstance, field: "feedback")}
						</td>

					</tr>
				</g:each>
			</tbody>
		</table>
		<div class="pagination">
			<g:paginate total="${questionInstanceCount ?: 0}" />
		</div>
	</div>
</body>
</html>
